﻿using System;
using MiWebSite_Core;
using WLMCoreLibrary;

namespace MWS_Main.Handlers.Gallery
{
    public partial class Default : System.Web.UI.Page
    {
        private WebSiteMainConfiguration config = WebSiteMainConfiguration.GetConfig();
        private dbConnector ConexionDB;

        protected void Page_Load( object sender, EventArgs e )
        {
            ConexionDB = new dbConnector( config.Connections[0].value );
            Response.Clear();
            Response.ContentType = "text/xml";
            Response.ContentEncoding = System.Text.Encoding.UTF8;
            if ( Request["idGaleria"] != null )
                Response.Write( WLMFunctions.SerializeObject( new SuccessObject( SuccessCode.UserLogged, "", GetGaleria( Convert.ToInt32( Request["idGaleria"] ) ).Elementos ), true ) );
            ConexionDB.CloseConnection();
        }

        protected MiWebSiteMediaImagesCollection GetGaleria( int idGalery )
        {
            MiWebSiteMediaImagesCollection galeria=new MiWebSiteMediaImagesCollection( idGalery, ref ConexionDB );
            return galeria;
        }
    }
}